<?php
	if($_POST["mag_id"]!=0){
		require_once("../connection.php");
		$connection=mysql_connect($server,$username,$password);
		if($connection){
			$database=mysql_select_db($db, $connection);
			$sql="SELECT mag_cliente, mag_numero
				FROM magove_t_partes
				WHERE mag_id=".$_POST["mag_id"].";";
			$query=mysql_query($sql);
			$i='0';
			$return_array='{';
			while($row=mysql_fetch_array($query)){
				$i++;
				$return_array.='"part'.$i.'":"'.$row["mag_cliente"].'-'.$row["mag_numero"].'",';
			}
			$connection=mysql_close();
			$return_array[strlen($return_array)-1]='}';
			echo $return_array;
		}
	}
	else{
		echo '{"part1":""}';
	}
?>
